|
|
|
|
|
|
|
LISTING 5.1. OBJECT DECLARATIONS. |
|
|
|
 |
|
|
|
|
1: In a general code module:
2:
3: Global theAccountCollection As New AccountCollection
4: Global theObjectFactory As New ObjectFactory
5: Global theFedFundsMonitor As FedFundsMonitor
6:
7: In ObjectFactory's General Declarations:
8: Dim theBankHolding As BankHolding
9: Dim theInterestBearingChecking As InterestBearingChecking
10: Dim theSavings As Savings |
|
|
|
|
|
|
|
|
Figure 5.1 shows the sequence diagram for the course of events that determines the interaction between these objects. Basically, interest is calculated and accrued for each type of account on a periodic basis. The object, theFedFundsMonitor, is responsible for providing the current Fed Funds Rate. |
|
|
|
|
|
|
|
|
Figure 5.1.
The sequence diagram illustrating the interaction between objects. |
|
|
|
|
|
|
|
|
The object, theObjectFactory, initializes theInterestBearingChecking, theSavings, and theBankHolding. Note that although theObjectFactory creates these three objects, it is not responsible for their lifetimes. This means that theObjectFactory is not composed of these three objects. |
|
|
|
|
|
|
|
|
Each of the objects theInterestBearingChecking, theSavings, and theBankHolding has lifetime responsibility for theFedFundsMonitor. Each is composed of instances of FedFundsMonitor. |
|
|
|
|
|
|
|
|
Finally, when each of the three objects has destroyed its respective instances of FedFundsMonitor, each object adds itself (using the Me keyword) to |
|
|
|
|
|